package com.Service;

import com.dao.StudentMapper;
import com.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentService {
    @Autowired
    private StudentMapper studentMapper;

    /**
     * 查询
     * @param student
     * @return
     */
    public List<Student> queryStudent(Student student){
        return studentMapper.selectAll();
    }

    /**
     * 新增
     * @param student
     * @return
     */
    public int addStudent(Student student){
        return studentMapper.insert(student);
    }

    /**
     * 删除
     * @param id
     * @return
     */
    public int delStudent(int id){
        return studentMapper.deleteByPrimaryKey(id);
    }

    /**
     * 修改
     * @param student
     * @return
     */
    public int updateStudent(Student student){
        return studentMapper.updateByPrimaryKey(student);
    }
}
